package cn.edu.nuc.zyb.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class Io {

	// 序列化
	public void write(Object obj) throws Exception {
		FileOutputStream fos = new FileOutputStream("F:\\zyb\\zybAdmin");
		ObjectOutputStream oos = new ObjectOutputStream(fos);
		oos.writeObject(obj);
	}

	// 反序列化
	public Object read(String path) throws Exception {

		
		FileInputStream fis = new FileInputStream(path);
		ObjectInputStream ois = new ObjectInputStream(fis);
		return ois.readObject();
	}
}
